package com.flyduck.vueshop.system.remote.controller;

import com.flyduck.vueshop.common.core.lang.Result;
import com.flyduck.vueshop.common.sotoken.annotation.InnerAuth;
import com.flyduck.vueshop.system.remote.service.RemoteMenuService;
import com.flyduck.vueshop.system.vo.RemoteMenuRespVO;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * <p>
 * SysUserApiController
 * </p>
 *
 * @author flyduck
 * @since 2024-07-09
 */
@RestController
@RequestMapping("/system/remote/menu")
public class RemoteMenuController {

    @Resource
    private RemoteMenuService remoteMenuService;

    @InnerAuth
    @GetMapping("/getPermissionListByUserId")
    public Result<List<String>> getPermissionListByUserId(@RequestParam("userId") Long userId){
        List<String> permissionList = remoteMenuService.getPermissionListByUserId(userId);
        return Result.success(permissionList);
    }

    @InnerAuth
    @GetMapping("/getEnableMenuListByUserId")
    Result<List<RemoteMenuRespVO>> getEnableMenuListByUserId(@RequestParam("userId") Long userId){
        List<RemoteMenuRespVO> remoteMenuRespVOList = remoteMenuService.getEnableMenuListByUserId(userId);
        return Result.success(remoteMenuRespVOList);
    }

    @InnerAuth
    @GetMapping("/getEnableMenuList")
    Result<List<RemoteMenuRespVO>> getEnableMenuList(){
        List<RemoteMenuRespVO> remoteMenuRespVOList = remoteMenuService.getEnableMenuList();
        return Result.success(remoteMenuRespVOList);
    }
}
